package com.neuedu.hw20190214;

public class Company {
    public void printEmployInfo(ColaEmployee colaEmployee,int month)
    {
        if(colaEmployee instanceof SalesEmployee) {
            SalesEmployee sales=(SalesEmployee)colaEmployee;
            System.out.println(month+"月份"+"出生年月为"+sales.getBirthMonth()+"姓名为"+sales.getEmName()+"的工资数额为："+sales.getSalary(month));
        }
        else if(colaEmployee instanceof SalariedEmployee)
        {
            SalariedEmployee salaried=(SalariedEmployee)colaEmployee;
            System.out.println(month+"月份"+"出生年月为"+salaried.getBirthMonth()+"姓名为"+salaried.getEmName()+"的工资数额为："+salaried.getSalary(month));
        }
        else if(colaEmployee instanceof  HourlyEmployee)
        {
            HourlyEmployee hourly=(HourlyEmployee)colaEmployee;
            System.out.println(month+"月份"+"出生年月为"+hourly.getBirthMonth()+"姓名为"+hourly.getEmName()+"的工资数额为："+hourly.getSalary(month));
        }
    }
}
